package com.lsk.util;

/**
 * 获取项目的绝对路径
 * Created by Administrator on 2017/9/1.
 */
public class PathUtil {
    public static final String  windowsRoot = "E:\\svn\\trunk\\staff\\jfinal_demo_for_maven\\target\\jfinal_demo_for_maven";//项目本地路径
    public static final String linuxRoot = "/home/tomcat/apache-tomcat-8.5.8/webapps/ROOT/";//linux系统路径

    public static final String windowsImgsPath="D:\\imgs\\";
    public static final String linuxImgsPath="";



    public static String getOS(){
        String os = System.getProperty("os.name");
        if (os.indexOf("in") != -1) {
            return "windows";
        } else {
            return "linux";
        }
    }

    /**
     * 获取系统文件分隔符
     * @return 获取系统文件分隔符
     */
    public static String getSeparator(){
        return System.getProperties().getProperty("file.separator");
    }

    public static String getRootPath() {
        String os = System.getProperty("os.name");
        if (os.indexOf("in") != -1) {
            return windowsRoot;
        } else {
            return linuxRoot;
        }
    }
    public static String getImgsPath(){
        String os = System.getProperty("os.name");
        if (os.indexOf("in") != -1) {
            return windowsImgsPath;
        } else {
            return linuxImgsPath;
        }
    }
}
